Developer Documentation
PATH  WebObjects 4.0 Documentation > WebObjects Tools and Techniques

Table of Contents Previous Section

Implementing the Action Method

To implement the action methods needed for linking to Direct to Web pages you must use methods of the D2W class and the page-specific Direct to Web interfaces. You also need to specify a hyperlink, active image, or similar HTML control with which to invoke the action method. Take the following example of a hyperlink; first, the HTML WebObjects tag:

<webObject name=D2WListPage>D2W list page</webObject>
Then, in the .wod file, bind the hyperlink to the action:

D2WListPage: WOHyperlink {
    action = d2wList;
}
The method for linking to a Direct to Web page must return a component (that is, a WOComponent object) that implements the interface appropriate to the required type of page. For example, if you want to link to a dynamically generated list page, the component returned must implement the ListPageInterface interface. Fortunately, the D2W class provides methods that create such components:

public WOComponent d2wList() {
        ListPageInterface 
lpi=D2W.factory().listPageForEntityNamed("Movie",session());
        lpi.setDataSource(movieDisplayGroup.dataSource());
        lpi.setNextPage(this);
        return (WOComponent)lpi;
    }
Notice that before you return the component, you must set things such as the data source for the component and the page to go to when users click the Return button (setNextPage).

Table of Contents Next Section